{include file="public/header" /}
<title>AMBL</title>
<header id="header" class="mui-bar mui-bar-nav">
    <div class="mui-pull-left PopupNavigation">
        <img src="/static/home/bl_1.png" alt="">
    </div>
    <h1 class="mui-title">{:lang('投资分红')}</h1>
    <div class="mui-pull-right" style="display: none;">
        <div class="mui-switch mui-active" >
            <div class="mui-switch-handle"></div>
        </div>
    </div>
</header>    

{include file="public/menu" /} <div id="pullrefresh" class="mui-content">
        <div class="mui-scroll">
            <div class="accumutzBox">
                <div class="accumutzTx">{:lang('累计投资金额')}</div>
                <div class="accumutzShu">$ <span id="invest_total">{:number_format($user['invest'],2)}</span></div>
            </div>
            <div class="mulativenumbBox">
                <div class="df mulativenumbxbd">
                    <div class="fx1 mulativenumbzi mulativenumbybd">
                        <div class="span_1">{:lang('累计分红')}</div>
                        <div class="span_2">$<span id="total_dividend">0</span></div>
                    </div>
                    <div class="fx1 mulativenumbzi">
                        <div class="span_1">{:lang('当日分红')}</div>
                        <div class="span_2">$<span id="day_dividend">0</span></div>
                    </div>
                </div>
                <div class="df">
                    <div class="fx1 mulativenumbzi mulativenumbybd">
                        <div class="span_1">{:lang('月分红')}</div>
                        <div class="span_2">$<span id="month_dividend">0</span></div>
                    </div>
                    <div class="fx1 mulativenumbzi">
                        <div class="span_1">{:lang('年分红')}</div>
                        <div class="span_2">$<span id="year_dividend">0</span></div>
                    </div>
                </div>
            </div>
            <!--走势  s-->
            <div class="communalBox">
                <div class="communalTl">
                    {:lang('平台分红走势图')} <span class="span_1">{:lang('单位')}($)</span>
                </div>
                <div class="chartBox zgui-PE-img"><div id="main" style="width:100%;height:220px;"></div></div>
            </div>
            <!--走势  e-->
            <div class="staataBox">
                <div class="staataTl">{:lang('分红明细查看')}</div>
                <div class="staataTableBox">
                    <table class="tabletada" border="0" cellspacing="" cellpadding="">
                        <thead>
                        <tr>
                            <th>{:lang('本金')}</th>
                            <th>{:lang('分红比例')}</th>
                            <th>{:lang('分红金额')}</th>
                            <th>{:lang('结算日期')}</th>
                        </tr>
                        </thead>
                        <tbody id="content">

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{include file="public/footer" /}
    <script src="/static/home/echarts.min.js" type="text/javascript" charset="utf-8"></script>
    <script>
        mui('.mui-scroll-wrapper').scroll({
            deceleration: 0.0005
        });

        var myChart = echarts.init(document.getElementById('main'));
        $.get('{:url('dividendTrend')}', function(res){
            option = {
                // tooltip : {
                //     trigger: 'axis'
                // },
               /* toolbox: {
                    show : true,
                    feature : {
                        mark : {show: true},
                        dataView : {show: false, readOnly: false},
                        magicType : {show: false, type: ['line', 'bar', 'stack', 'tiled']},
                        restore : {show: false},
                        saveAsImage : {show: false}
                    }
                },*/
                // calculable : true,
                xAxis : [
                    {
                        type : 'category',
                        boundaryGap : false,
                        data : res.key
                    }
                ],
                yAxis : [
                    {
                        type : 'value',
                        splitLine:{show:false},
                    }
                ],
                series : [
                    {
                        type:'line',
                        stack: '总量',
                        data:res.data,
                        label:{
                            normal:{
                                show:true
                            }
                        }
                    }
                ]
            };

            myChart.setOption(option);
        });
    </script>
    <script>
        $(document).ready(function () {
            ajaxGetOrder();
        });
        var page = 0;

        function ajaxGetOrder() {
            if (stop == true || page == 0) {
                stop = false;
                if (page == 0) {
                    $('#content').html('');
                }
                $.ajax({
                    type: "GET",
                    url: "{:url('profitLog')}",//+tab,
                    data: {p: page},
                    success: function (data) {
                        page += 1;
                        $('.loadAdd').hide();
                        // layer.close(getMoreLoad);
                        if ($.trim(data) == '') {
                            stop = false;
                        } else {
                            stop = true;
                            var html = '';
                        for(var i=0;i<data.list.length;i++){
                            html += '<tr><td>'+data.list[i].chip+'</td>';
                            html += '<td>'+data.list[i].rate+'%</td>';
                            html += '<td>'+data.list[i].num+'</td>';
                            html += '<td>'+data.list[i].created+'</td></tr>';
                        }
                        $('#content').append(html);
                        }
                    }, error: function () {
                        mui.toast('网络失败，请刷新后重试', {duration: 'long', type: 'div'})
                    }
                });
            }
        }

        var bottomH = 50;//距离底部多少像素开始加载
        var stop = true;
        $(window).scroll(function () {
            totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop() + bottomH);
            if ($(document).height() <= totalheight) {
                ajaxGetOrder();
            }
        });
        $.post("{:url('index')}", function(res){
            $('#total_dividend').html(res.total);
            $('#day_dividend').html(res.dayTotal);
            $('#month_dividend').html(res.monthTotal);
            $('#year_dividend').html(res.yearTotal);
        });
    </script>
</body>

</html>